<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:p="http://primefaces.org/ui"
        xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head> </h:head>
<h:body style="background:#2A2D30" >

        <p:panel  header="Flight">
                <h:form id="form">
                        <p:dataTable id="flightPanel"
                                value="#{flightbean.listFlightDTO}" var="flight"
                                emptyMessage="There is no Flight yet in database" 
                                rows="10">
                                
                                <p:column headerText="Departure">
                                        <h:outputText value="#{flight.fDeparture}" />
                                </p:column>
         
                                <p:column headerText="Destination">
                                        <h:outputText value="#{flight.fDestination}" />
                                </p:column>
         
                                <p:column headerText="AirLine">
                                        <h:outputText value="#{flight.fNumber}" />
                                </p:column>
                                 <p:column headerText="Price">
                                        <h:outputText value="#{flight.fPrice}" />
                                </p:column>
                                                                
                                <p:column>
                                <p:commandButton value="Delet" action="#{flightbean.remove(flight.fID)}"
                                   update="flightPanel" title="Complete"
                                    oncomplete="PF('successDialog').show()"/>
                                </p:column>
                         
                        </p:dataTable>
                        
                  <p:dialog header="Status" widgetVar="successDialog" resizable="false"
                        id="successDlg" showEffect="fade" hideEffect="drop" modal="true"
                        draggable="no">
                        <p:panel >
                                <h:panelGrid columns="3">
                                        <h:outputText value="Selected Flight is deleted!"/>
                                </h:panelGrid>
                        </p:panel>
                        <h:form>
                                <br />
                                <p:button value="Ok!" outcome="deletFlight.xhtml" />
                              
                        </h:form>
                </p:dialog>
                  
   </h:form> 
   
</p:panel>  
        <br></br>
       <p:panel>
      <p:button value="back" outcome="index.xhtml" />
 </p:panel>
      
                      
                             
</h:body>
</html>
